<!-- 
说明：会员支付流水表列表
作者：292303959@qq.com
日期：2018-10-17 10:5:57
版本：1.0.0
-->
<template>
  <div>
    <mk-search-box>
      <el-row>
        <el-col :span="5">
          <label>会员名称:</label>
          <el-input v-model="ui.searchData.mname"
                    size="small"></el-input>
        </el-col>
        <el-col :span="5">
          <label>订单编号:</label>
          <el-input v-model="ui.searchData.orderid"
                    size="small"></el-input>
        </el-col>
        <el-col :span="5">
          <label>支付类型:</label>
          <mk-config-select mk-config="Z_PAYTYPE"
                            v-model="ui.searchData.paytype"
                            size="small"
                            mkEmptyLabel="请选择"></mk-config-select>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="5">
          <label>付款时间:</label>
          <el-date-picker v-model="ui.searchData.ofdate"
                          type="daterange"
                          align="right"
                          format="yyyy-MM-dd"
                          placeholder="选择日期范围">
          </el-date-picker>
        </el-col>

        <el-col :span="5">
          <label>收支类型:</label>
          <mk-config-select mk-config="Z_FLOW_OFFLAG"
                            v-model="ui.searchData.offlag"
                            size="small"
                            mkEmptyLabel="请选择">
          </mk-config-select>
        </el-col>
        <el-col :span="3">
          <mk-search-buttons v-model="ui.searching" />
        </el-col>
      </el-row>
    </mk-search-box>

    <mk-table v-model="ui"
              mk-multiple
              mk-index
              mk-sql-code="tMbOrderFlow.select_list"
              mk-table-id="t-mb-order-flow.list.common"
              :mk-init-search-data="initSearchData"
              ref="table">
      <el-table-column align="left"
                       prop="orderid"
                       label="订单编号"
                       width="200" />
      <el-table-column align="left"
                       prop="mname"
                       label="客户名称"
                       width="150" />
      <el-table-column align="left"
                       prop="payamount"
                       label="支付金额"
                       width="80" />
      <el-table-column align="left"
                       prop="paytype"
                       label="支付方式"
                       width="80">
        <template slot-scope="paytypescope">
          {{paytypescope.row.paytype | data-config('Z_PAYTYPE')}}
        </template>
      </el-table-column>
      <el-table-column align="left"
                       prop="payorderno"
                       label="支付流水号"
                       width="200" />
      <el-table-column align="left"
                       prop="ofdate"
                       label="时间"
                       width="150" />
      <el-table-column align="left"
                       prop="offlag"
                       label="收支类型"
                       width="80">
        <template slot-scope="offlagscope">
          {{offlagscope.row.offlag | data-config('Z_FLOW_OFFLAG')}}
        </template>
      </el-table-column>
    </mk-table>
  </div>
</template>

<script>
  import {
    MkBase
  } from 'element-ui'
  import searchData from './list/search-data'
  import dayjs from 'dayjs'

  export default {
    name: 't-mb-order-flow-list',
    mixins: [MkBase],
    components: {
    },
    data () {
      return {
        ui: {
          searching: true,
          searchData: searchData()
        }
      }
    },
    methods: {
      /**
       * 刷新本页面
       */
      doSearch () {
        this.ui.searching = true
      },
      initSearchData (data, flag) {
        if (data.ofdate.length > 0) {
          data.bdate = dayjs(data.ofdate[0]).format('YYYY-MM-DD 00:00:00')
          data.edate = dayjs(data.ofdate[1]).format('YYYY-MM-DD 23:59:59')
        }
      }
    }
  }
</script>